import { uuid } from 'uuidv4';
import Component from '@/components/Component';
import { useEffect, useState } from 'react';

export type IProps = { components:any; setMessage:any};

const Layout: React.FC<IProps> = (props:any) => {
  //const [comp, setComp] = useState<any>();
  const setMessage = (message:any) => {
    props?.setMessage(message);
  }
  // useEffect(()=>{
  //   setComp(null);
  // },[])
  return (
    <>
      {props?.components?.map((component:any)=>{
        return <Component key={uuid()} name={component.name} component={component.component} setMessage={setMessage} />
      })}
    </>
  );
};

export default Layout;
